package com.clear.honghefinance.admin.controller;

import com.clear.honghefinance.biz.modules.system.role.service.ISysRoleBindResourceService;
import com.clear.honghefinance.common.dto.entity.ApiResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "系统角色绑定资源")
@RestController
@RequestMapping(value = "/sysRoleBindResource")
@Slf4j
public class SysRoleBindResourceController {

    @Resource
    private ISysRoleBindResourceService sysRoleBindResourceService;

    /**
     * 查询角色绑定的资源id列表 查看某个角色绑定的资源id列表
     *
     * @param roleId
     * @return
     */
    @ApiOperation(value = "查询角色绑定的资源id列表")
    @GetMapping(value = "/listBindResourceIdByRoleId")
    public ApiResponse<List<Integer>> listBindMenuIdByRoleId(@RequestParam int roleId) {
        return ApiResponse.success(sysRoleBindResourceService.listBindResourceIdByRoleId(roleId));
    }
}